import { IFeidaoAiNodejsComponent } from '@dfeidao/atom-nodejs/interfaces';
import nodejs from '@dfeidao/atom-nodejs/msg/nodejs';
import render from '@dfeidao/atom-nodejs/render/render';
import p001 from './p001';
import p002 from './p002';

export default async function na001(fd: IFeidaoAiNodejsComponent) {
	const pn = fd.data.params['page-no'] as string;
	let pno = 1;
	if (pn) {
		pno = parseInt(pn, 10);
	}

	console.log(pno);
	// todo

	const res = await nodejs<{ res: Array<{}>; c: number; }>(fd.data.actionid, fd.data.sessionid, 'customer-care/zj-000001/s001', { page_no: pno });
	console.info(res);
	render(fd.data.node, res.res, p001, 'p001');
	render(fd.data.node, res.c, p002, 'p002');
}
